package com.tfh.strategy;

import java.math.BigDecimal;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

public class MonthMeanAlloter extends Alloter {
    /**
     * @param rentAmounts
     * @return
     */
    @Override
    protected List<BigDecimal> calc(List<RentAmount> rentAmounts) {
        return rentAmounts.stream().map((RentAmount rent) -> {
            final BigDecimal monthAmount = rent.monthAmount();
            final List<Long> range = rent.range();
            return range.stream().map((Long l) -> monthAmount).collect(Collectors.toList());
        }).flatMap(Collection::stream).collect(Collectors.toList());
    }
}
